package br.com.nrti.still.eventos;

import android.content.Context;
import android.media.AudioManager;

public class Alarme {
	public static final String ACAO_ALARME_NAO_ALTERAR = "NAO";
	public static final String ACAO_ALARME_DESLIGAR = "DES";
	public static final String ACAO_ALARME_LIGAR = "LIG";
	public static final String ACAO_ALARME_VOLTAR_ANTERIOR = "ANT";
	
	private static AudioManager aManager;
	private static int volumeAnterior;

	public static void inicializar(Context context) {
		aManager = (AudioManager) context
				.getSystemService(context.AUDIO_SERVICE);
	}

	public static int getVolumeAtual() {
		return aManager.getStreamVolume(AudioManager.STREAM_ALARM);
	}

	public static void setMuteOn() {
		volumeAnterior = getVolumeAtual();
		aManager.setStreamVolume(AudioManager.STREAM_ALARM, 0,
				AudioManager.FLAG_SHOW_UI + AudioManager.FLAG_PLAY_SOUND);
	}

	public static void setMuteOff() {
		aManager.setStreamVolume(AudioManager.STREAM_ALARM, volumeAnterior,
				AudioManager.FLAG_SHOW_UI + AudioManager.FLAG_PLAY_SOUND);
	}
}
